package com.dempsey.controller;

import com.dempsey.dao.Book;
import com.dempsey.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author Dempsey
 * Date 2022/1/21
 * Description
 */

@Controller
@RequestMapping("/book")
public class BookController {

    @Autowired
    private BookService bookService;

    @GetMapping("/queryAllBook")
    public String queryAllBook(Model model) {
        List<Book> books = bookService.queryAll();

        model.addAttribute("books", books);

        return "allBook";
    }

}
